package com.zp.flyweight;/**
 * @description
 * @author zp
 * @created 2021/9/3 21:38
 */

import com.zp.entity.Color;

/**
 * @author zp
 * @description
 * @created 2021/9/3 21:38
 */
public class FlywightPatternDemo {
    public static void main(String[] args) {
        ColorFactory colorFactory = new ColorFactory();
        Color red = colorFactory.getColor("red");
        red.fill();
        System.out.println("red内存地址1："+red.toString());
        Color blue = colorFactory.getColor("blue");
        blue.fill();
        Color green = colorFactory.getColor("green");
        green.fill();
        red = colorFactory.getColor("red");
        red.fill();
        System.out.println("red内存地址2："+red.toString());
    }
}
